﻿using Microsoft.EntityFrameworkCore;
using Ordering.Orders;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.DistributedEvents;

namespace Ordering.EntityFrameworkCore
{
    [ConnectionStringName(OrderingDbProperties.ConnectionStringName)]
    public class OrderingDbContext : AbpDbContext<OrderingDbContext>, IOrderingDbContext, IHasEventOutbox, IHasEventInbox
    {
        public DbSet<Order> Orders { get; set; }
        public DbSet<IncomingEventRecord> IncomingEvents { get; set; }
        public DbSet<OutgoingEventRecord> OutgoingEvents { get; set; }

        public OrderingDbContext(DbContextOptions<OrderingDbContext> options) 
            : base(options)
        {

        }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);

            builder.ConfigureOrdering();
        }
    }
}